//
//  SmallDecisionsBaseNavigationController.m
//  SmallDecisions
//
//  Created by 李付雄 on 2025/6/14.
//

#import "SmallDecisionsBaseNavigationController.h"

@interface SmallDecisionsBaseNavigationController ()<UIGestureRecognizerDelegate>

@end

@implementation SmallDecisionsBaseNavigationController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.interactivePopGestureRecognizer.delegate = self;
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
    if (self.viewControllers.count > 0) {
        
        [viewController setHidesBottomBarWhenPushed:YES];
    }
    [super pushViewController:viewController animated: animated];
}

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {

    if (self.viewControllers.count <= 1) {

        return NO;
    }
    return YES;
}

- (BOOL)shouldAutorotate{

    return [self.visibleViewController shouldAutorotate];
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{

    return [self.visibleViewController supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{

    return [self.visibleViewController preferredInterfaceOrientationForPresentation];
}


@end
